package de.iritgo.skillfull.entity.command;

import de.iritgo.skillfull.component.visitor.BarVisitor;
import de.iritgo.skillfull.component.visitor.SimpleTextVisitor;
import de.iritgo.skillfull.entity.Command;
import de.iritgo.skillfull.entity.Entity;

public class BarCommand implements Command 
{
	private Entity entity;
	private SimpleTextVisitor simpleTextVisitor;
	private BarVisitor barVisitor;
	
	public BarCommand (Entity entity, String text, float rwidth, float rheight, float timeOnScreen)
	{
		this.entity = entity;
		simpleTextVisitor = new SimpleTextVisitor (text, timeOnScreen); 
		barVisitor = new BarVisitor (rwidth, rheight);
	}

	public String getName ()
	{
		return "Bar"; 
	}

	@Override
	public boolean canPerform () 
	{
		return true;
	}

	@Override
	public void perform (int delta) 
	{
		entity.accept (simpleTextVisitor);
		entity.accept (barVisitor);
	}
	
	@Override
	public void stop() 
	{
	}

	public Command getUndoCommand () 
	{
		return null;
	}

	@Override
	public boolean isDone () 
	{
		return true;
	}
}
